package com.fanluo.luoproject.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/users")
@Tag(name = "用户管理", description = "用户相关的接口") // 类级别的注解，描述控制器
public class UserController {
    // http://localhost:8080/swagger-ui/index.html
    @GetMapping("/{id}")
    @Operation(summary = "根据 ID 获取用户", description = "通过用户 ID 查询用户信息") // 方法级别的注解，描述接口
    public String getUserById(
            @Parameter(description = "用户 ID", required = true) // 参数注解，描述参数
            @PathVariable Long id) {
        return "用户 ID: " + id;
    }
}
